package example;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService()
public class TaxComputation {
  @WebMethod
  public double calculateTax(double income) {
      // 简单的税率计算示例（具体税率根据当地政策调整）
      double taxRate;
      if (income <= 36000) {
          taxRate = 0.03;
      } else if (income <= 144000) {
          taxRate = 0.1;
      } else if (income <= 300000) {
          taxRate = 0.2;
      } else if (income <= 420000) {
          taxRate = 0.25;
      } else if (income <= 660000) {
          taxRate = 0.3;
      } else if (income <= 960000) {
          taxRate = 0.35;
      } else {
          taxRate = 0.45;
      }

      // 计算税额，这里假设没有起征点和其他扣除项
      double tax = income * taxRate - (income <= 36000 ? 0 : (income - 36000) * 0.03); // 假设36000以下为免税额度
      return tax;
  }
    public static void main(String[] argv) {
    Object implementor = new TaxComputation();
    String address = "http://localhost:9000/tax";
    Endpoint.publish(address, implementor);
  }
}
